const user = {
  state: {
    name: '',
    avatar: '',
    roles: '',
    productUuid: '',
    channelUuid: ''
  },

  mutations: {
    SET_TOKEN: (state, token) => {
      state.token = token
    },
    SET_NAME: (state, name) => {
      state.name = name
    },
    SET_AVATAR: (state, avatar) => {
      state.avatar = avatar
    },
    SET_ROLES: (state, roles) => {
      state.roles = roles
    },
    SET_PRODUCT_UUID: (state, productUuid) => {
      state.productUuid = productUuid
    },
    SET_CHANNEL_UUID: (state, channelUuid) => {
      state.channelUuid = channelUuid
    }
  },

  actions: {
    // 获取用户信息
    SetRoles({ commit, data }) {
      commit('SET_ROLES', data.role)
    }
  }
}

export default user
